package com.peixunp.quartz;

import java.io.File;

import javax.servlet.ServletContext;

import org.springframework.beans.factory.annotation.Autowired;

import com.peixunp.service.RemarkService;
import com.peixunp.util.Constants;

public class Job1Hour {

	@Autowired
	private ServletContext servletContext;
	
	@Autowired
	private RemarkService remarkService;
	
	public void work1hour() {
		String file_real_path = servletContext.getRealPath("WEB-INF"+File.separator+"jsp"+File.separator+"school");
		try {
			//每1小时自动生成首页最高分学校前5个学校
			remarkService.autoCreate5HighCoin(file_real_path);
		} catch (Exception e) {
			if(Constants.ISDEBUG){
				e.printStackTrace();
			}
		}
		try {
			//每1小时自动生成首页评论最多前5个学校
			remarkService.autoCreate5MostRemark(file_real_path);
		} catch (Exception e) {
			if(Constants.ISDEBUG){
				e.printStackTrace();
			}
		}
	}
	
}
